package cn.bdqn.controller;

import cn.bdqn.pojo.SysUser;
import cn.bdqn.service.SysUserService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class SysUserController {
    @Resource
    SysUserService sysUserService;
//    @RequestMapping(value = "/getUser",method = RequestMethod.GET)
//    public SysUser getUser(Long userId){
//        return sysUserService.getUser(userId);
//    }
    @GetMapping("/sysUser/{id}")
    public SysUser getUser(@PathVariable("id") Long id){
        return sysUserService.getUser(id);
    }
    @GetMapping("/sysUser")
    public List<SysUser> findAllUsers(){
        return sysUserService.findAllUsers();
    }
    @PostMapping("/sysUser")
    public void addUser(SysUser sysUser){
        sysUserService.addUser(sysUser);
    }
    @PutMapping("/sysUser")
    public void updateUser(SysUser sysUser){
        sysUserService.updateUser(sysUser);
    }
    @DeleteMapping("/sysUser/{id}")
    public void deleteUser(@PathVariable("id") Long id){
        sysUserService.deleteUser(id);
    }
}
